<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/js/xadmin.js"></script>
</head>
<body>
<form class="x-so" action="/user/resultPage" id="myform" style="margin-top: 30px" >
    <select id="condition" name="condition" style="width: 140px;height: 37px">
        <option value="--------">----</option>
        <option value="编号">编号</option>
        <option value="服务类型">服务类型</option>
        <option value="服务日期">服务日期</option>
        <option value="处理人">处理人</option>
        <option value="完成时间">完成时间</option>


    </select>
    <input class="layui-input" name="conValue" th:value="${vv}" type="text" id="conValue" placeholder="请输入查询条件">
    <!--<input type="submit" class="layui-btn layui-btn-normal" value="查询" >-->
    <input type="button" class="layui-btn layui-btn-normal" onclick="search()" value="查询" >
    <a id="dlink"  style="display:none;"></a>
    <input type="button" class="layui-btn layui-btn-normal" onclick="tableToExcel('tables', 'name', 'myfile.xls')" value="导出">
</form>

<table  class="layui-table"  id="tables">
    <thead>
    <th>反馈编号</th>
    <th>用户名</th>
    <th>客户姓名</th>
    <th>服务编号</th>
    <th>经理</th>
    <th>处理人</th>
    <th>服务类型</th>
    <th>服务日期</th>
    <th>客户联系方式</th>
    <th>预估成本</th>
    <th>服务时间</th>
    <th>内容描述</th>
    <th>经理是否已读</th>
    <th>客户反馈意见</th>
    <th>客户满意度</th>
    <th>完成时间</th>
    <th>操作</th>
    </thead>
    <tbody>
    <tr th:each="i:${info.list}">
        <td th:text="${i.resultId}"></td>
        <td th:text="${i.serUserNickName}"></td>
        <td th:text="${i.serName}"></td>
        <td th:text="${i.serId}"></td>
        <td th:text="${i.serManager}"></td>
        <td th:text="${i.resultManager}"></td>
        <td th:text="${i.serType}"></td>
        <td th:text="${i.serTime}"></td>
        <td th:text="${i.serUserTel}"></td>
        <td th:text="${i.serSpendMoney}"></td>
        <td th:text="${i.serSpendTime}"></td>
        <td th:text="${i.serContent}"></td>
        <td th:text="${i.serRead}"></td>
        <td th:text="${i.resultUserBack}"></td>
        <td th:text="${i.resultUsereVal}"></td>
        <td th:text="${i.resultTimei}"></td>
        <td>
            <button class="layui-btn layui-btn-normal" type="button" onclick="update(this)" >修改</button>
        </td>
    </tr>
    </tbody>
</table>
<div style="margin-top: 20px" class="x-so">
    <a class="layui-btn layui-btn-normal" th:href="@{/user/resultPage(page=${info.pre})}" >上一页</a>
    第<span th:text="${info.cur}"></span>页
    <a class="layui-btn layui-btn-normal" th:href="@{/user/resultPage(page=${info.next})}" >下一页</a>
    共<span th:text="${info.totalPage}"></span>页/
    <span th:text="${info.total}"></span>条数据


</div>
</body>
</html>
<script>
    //打开修改页面的发法
    function update(obj) {
        //huoqu当前选中行的userId值
        var id=$(obj).parent().parent().find("td").eq(3).text();
        //打开弹窗
        x_admin_show("修改","/user/resulteditPage?serId="+id,700,500);
    }
    //excle导出
    //打开修改页面的发法
    function exportd() {
        //打开弹窗
        x_admin_show("修改","/user/resulteditPage?serId="+id,700,500);
    }

    //删除
    var timer;
    function getExplorer(){//获取浏览器
        var explorer=window.navigator.userAgent;
        if(explorer.indexOf("MSIE") >= 0|| (explorer.indexOf("Windows NT 6.1;") >= 0 && explorer.indexOf("Trident/7.0;") >= 0)){
            return 'ie';
        }else if (explorer.indexOf("Firefox") >= 0) {
            return 'Firefox';
        }else if(explorer.indexOf("Chrome") >= 0){
            return 'Chrome';
        }else if(explorer.indexOf("Opera") >= 0){
            return 'Opera';
        }else if(explorer.indexOf("Safari") >= 0){
            return 'Safari';
        }
    }

    //excle导出
    var tableToExcel = (function () {
        var uri = 'data:application/vnd.ms-excel;base64,',
            template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
            base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) },
            format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) };
        return function (table, name, filename) {
            if (!table.nodeType) table = document.getElementById(table)
            var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML }

            document.getElementById("dlink").href = uri + base64(format(template, ctx));
            document.getElementById("dlink").download = filename;
            document.getElementById("dlink").click();
        }
    })()

    //查询验证
    function search() {
        //获取用户输入的查询条件
        var v=$("#conValue").val();
        //获取用户选择的查询
        var con=$("#condition").val();
        //判断用户选择的查询条件是什么
        if(con=="编号")
        {
            //创建一个正则表达式对象
            var re=/^[0-9]*$/
            //验证用户输入的信息是否是数字
            if(re.test(v)){
                //用js做表单提交
                document.getElementById("myform").submit();
            }else {
                layer.alert("请输入数字");
            }
        }
        else
        {
            //用js做表单提交
            document.getElementById("myform").submit();
        }

    }
</script>